package cn.kimming.wms.query;

import java.util.Date;

import cn.kimming.wms.util.DateUtils;
import lombok.Getter;
import lombok.Setter;

public class StockOutcomeBillQueryObject extends QueryObject{
	@Getter @Setter
	private Date beginDate;
	@Getter @Setter
	private Date endDate;
	@Getter @Setter
	private Long depotId = -1L;
	@Getter @Setter
	private Long clientId = -1L;
	@Getter @Setter
	private int status = -1;
	
	@Override
	protected void customizedQuery() {
		if (beginDate != null) {
			addCondition("obj.vdate >= ?", DateUtils.getBeginDate(beginDate));
		}
		if (endDate != null) {
			addCondition("obj.vdate <= ?", DateUtils.getEndDate(endDate));
		}
		if (depotId > 0) {
			addCondition("obj.depot.id = ?", depotId);
		}
		if (clientId > 0) {
			addCondition("obj.client.id = ?", clientId);
		}
		if (status >= 0){
			addCondition("obj.status = ?", status);
		}
	}
}
